package com.tgu.home_action.dao;

import com.tgu.home_action.pojo.Case;
import com.tgu.home_action.pojo.OldMan;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.DeleteMapping;

import java.util.List;

@Repository
public interface OldManMapper {
    /**
     * 插入老人信息
     */
    void insertOldMan(OldMan oldMan);

    /**
     * 查询老人信息
     */
    @Select("select * from old_man where family_id=#{familyId}")
    List<OldMan> getOldMenByFamilyId(Integer familyId);

    /**
     * 更改老人信息
     */
    Boolean updateOldMan(OldMan oldMan);

    /**
     * 删除老人信息
     */
    Boolean deleteOldMan(OldMan oldMan);

    /**
     * 通过id查询老人信息
     */
    @Select("select * from old_man where id=#{oldManId}")
    OldMan getById(Integer oldManId);

    /**
     * 管理员修改老人信息
     */
    Boolean adminUpdateOldMan(OldMan oldMan);

    /**
     * 通过家属ID删除老人信息
     */
    @Delete("delete from old_man where family_id=#{id}")
    void deleteOldManByFamilyId(Integer id);


    /**
     * 通过人脸ID获取老人信息
     */
    OldMan getOldManByFaceId(Integer faceId);
}
